#include "sceneObjs.h"

void setCamera( Camera &myCamera , Vector &position , Vector &view_direction , Vector &up_vector ) {
    myCamera.position = position;
    myCamera.view_direction = view_direction;
    myCamera.up_vector = up_vector;
}

void setParticles( Particles &myParticles , double &mass , int &radius , int &num ) {
    myParticles.number = num;
    myParticles.massInv = (double*) malloc( num * sizeof(double) );
    myParticles.radius = (int*) malloc( num * sizeof(int) );
    myParticles.position = (Vector*) malloc( num * sizeof(Vector) );
    myParticles.velocity = (Vector*) malloc( num * sizeof(Vector) );
    myParticles.acceleration = (Vector*) malloc( num * sizeof(Vector) );

    int i;
    double massInv = 1 / mass;
    for( i=0; i < num; i++ ) {
        myParticles.massInv[i] = massInv;
        myParticles.radius[i] = radius;
        double px = 0.0;
        double py = 0.0;
        double pz = 0.0;
        SETVECTOR( myParticles.position[i] , px , py , pz )
        double vx = VELOCITY_MIN + ( (double)rand() / RAND_MAX ) * ( VELOCITY_MAX - VELOCITY_MIN );
        double vy = VELOCITY_MIN + ( (double)rand() / RAND_MAX ) * ( VELOCITY_MAX - VELOCITY_MIN );
        double vz = VELOCITY_MIN + ( (double)rand() / RAND_MAX ) * ( VELOCITY_MAX - VELOCITY_MIN );
        SETVECTOR( myParticles.velocity[i] , vx , vy , vz )
        SETVECTOR( myParticles.acceleration[i] , 0 , 0 , 0 )
    }
}

void setBox( Box &myBox , double &size , double &radius ) {
    myBox.size = size;
    myBox.radius = radius;
}
